package com.dianxin.smartpark.web.attendance;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.chinatelecom.response.common.CommonResponseBody;
import com.dianxin.smartpark.dao.qo.attendance.SmartParkHolidayDetailQO;
import com.dianxin.smartpark.service.attendance.SmartParkHolidayDetailService;
import com.dianxin.smartpark.service.vo.attendance.SmartParkHolidayDetailVO;
import com.dianxin.sso.client.annotation.RecordLog;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 节假日管理
 * @program: smart-park
 * @description: 节假日管理
 * @author: chenyong
 * @create: 2021-07-20 11:42
 */
@RestController
@RequestMapping("/smartpark/attendance/HolidayDetail")
public class SmartParkHolidayDetailController {

    @Resource
    private SmartParkHolidayDetailService smartParkHolidayDetailService;


    /**
     * 添加节假日信息
     * @Description:  添加节假日信息
     * @Author: ChenYong
     * @Date: 2021/7/21 0021
     * @param smartParkHolidayDetailQO:
     * @Return: CommonResponseBody
     */
    @PostMapping("/saveHolidayDetail")
    //@RecordLog(name = "添加节假日信息")
    //@SaCheckPermission("/attendance/HolidayDetail/saveHolidayDetail")
    public CommonResponseBody saveHolidayDetail(@RequestBody SmartParkHolidayDetailQO smartParkHolidayDetailQO){
        return smartParkHolidayDetailService.saveHolidayDetail(smartParkHolidayDetailQO);
    }

    /**
     * 通过qo查询List
     * @Description:  通过qo查询List
     * @Author: ChenYong
     * @Date: 2021/7/21 0021
     * @param smartParkHolidayDetailQO:
     * @Return: CommonResponseBody<List<SmartParkHolidayDetail>>
     */
    @PostMapping("/getListAll")
    //@RecordLog(name = "查询节假日")
    //@SaCheckPermission("/attendance/HolidayDetail/getListAll")
    public CommonResponseBody<List<SmartParkHolidayDetailVO>> getListAll(@RequestBody SmartParkHolidayDetailQO smartParkHolidayDetailQO){
        smartParkHolidayDetailQO.setIsDeleted(0);
        return smartParkHolidayDetailService.getListAll(smartParkHolidayDetailQO);
    }

    /**
     * 删除节假日信息
     * @Description:  删除节假日信息
     * @Author: ChenYong
     * @Date: 2021/7/23 0023
     * @param smartParkHolidayDetailQO:
     * @Return: CommonResponseBody<List<SmartParkHolidayDetailVO>>
     */
    @PostMapping("/deleteHolidayDetail")
    //@RecordLog(name = "删除节假日信息")
    //@SaCheckPermission("/attendance/HolidayDetail/deleteHolidayDetail")
    public CommonResponseBody<List<SmartParkHolidayDetailVO>> deleteHolidayDetail(@RequestBody SmartParkHolidayDetailQO smartParkHolidayDetailQO){
        return smartParkHolidayDetailService.deleteHolidayDetail(smartParkHolidayDetailQO);
    }

    /**
     * 查询是否需要打卡
     * @Description:  通过日期时间查询查询是否需要打卡（true:需要打卡，false：不需要打卡）
     * @Author: ChenYong
     * @Date: 2021/7/22 0022
     * @param smartParkHolidayDetailQO:
     * @Return: CommonResponseBody true 为需要打卡  false 为不需要打卡
     */
    @PostMapping("/queryByDate")
    //@RecordLog(name = "查询是否需要打卡")
    //@SaCheckPermission("/attendance/HolidayDetail/queryByDate")
    public CommonResponseBody queryByDate(@RequestBody SmartParkHolidayDetailQO smartParkHolidayDetailQO) {
        return smartParkHolidayDetailService.queryByDate(smartParkHolidayDetailQO);
    }
}
